package org.blueoxygen.kukuruyuk.action.masterreceipe;

import java.util.ArrayList;
import java.util.List;
import org.blueoxygen.cimande.persistence.PersistenceAware;
import org.blueoxygen.cimande.persistence.PersistenceManager;
import org.blueoxygen.cimande.security.SessionCredentials;
import org.blueoxygen.cimande.security.SessionCredentialsAware;
import org.blueoxygen.kukuruyuk.entity.MasterReceipe;
import org.blueoxygen.kukuruyuk.entity.PurchaseOrder;
import com.opensymphony.xwork2.ActionSupport;
public class MasterReceipeForm extends ActionSupport
implements PersistenceAware, SessionCredentialsAware {
     protected PersistenceManager manager;
     protected SessionCredentials sessionCredentials;
     private MasterReceipe masterreceipe = new MasterReceipe();
     private List<MasterReceipe> masterreceipes = new ArrayList<MasterReceipe>();
     
     private PurchaseOrder po = new PurchaseOrder();
     private List<PurchaseOrder> pos = new ArrayList<PurchaseOrder>();

     public String execute(){
          if(getMasterreceipe().getId() != null &&
                  !"".equalsIgnoreCase(getMasterreceipe().getId().trim())){
              setMasterreceipe((MasterReceipe) manager.getById(MasterReceipe.class, getMasterreceipe().getId()));    
          }
          setPos(manager.findAllSorted(PurchaseOrder.class,"id"));
          return SUCCESS;
     }
     public void setPersistenceManager(PersistenceManager persistenceManager){
          this.manager = persistenceManager;
     }
     public void setSessionCredentials(SessionCredentials sessionCredentials){
          this. sessionCredentials = sessionCredentials;
     }
     public MasterReceipe getMasterreceipe() {
          return masterreceipe;
     }
     public void setMasterreceipe(MasterReceipe masterreceipe) {
       this.masterreceipe = masterreceipe;
   }
   public List<MasterReceipe> getmasterreceipes() {
       return masterreceipes;
   }
   public void setMasterreceipes(List<MasterReceipe> masterreceipes) {
       this.masterreceipes = masterreceipes;
   }
   
   
   public PurchaseOrder getPo() {
       return po;
   }
   public void setPo(PurchaseOrder po) {
       this.po = po;
}
public List<PurchaseOrder> getPos() {
    return pos;
}
public void setPos(List<PurchaseOrder> pos) {
    this.pos = pos;
}
}



